<?php

	include "kernel.php";

    $r = mysql_query("select id, tag, coname,xoname, squadpage from squadrons where tag LIKE '% %' or coname LIKE '% %' or xoname LIKE '% %' or squadpage LIKE '% %'");
    while ($res = mysql_fetch_assoc($r)) {

    	$res[tag] = ereg_replace(" ","",$res[tag]);
    	$res[coname] = ereg_replace(" ","",$res[coname]);
    	$res[xoname] = ereg_replace(" ","",$res[xoname]);
    	$res[squadpage] = ereg_replace(" ","",$res[squadpage]);

        mysql_query("update squadrons set tag='".$res[tag]."', coname='".$res[coname]."', xoname='".$res[xoname]."', squadpage='".$res[squadpage]."' where id='".$res[id]."'");
               echo "update squadrons set tag='".$res[tag]."', coname='".$res[coname]."', xoname='".$res[xoname]."', squadpage='".$res[squadpage]."' where id='".$res[id]."'\r\n";
    }

	$r = mysql_query("select pilotid, callsign from finalpilots where callsign LIKE '% %'");
    while ($res = mysql_fetch_assoc($r)) {

    	$res[callsign] = ereg_replace(" ","",$res[callsign]);

        mysql_query("update finalpilots set callsign='".$res[callsign]."' where pilotidid='".$res[pilotid]."'");
               echo "update finalpilots set callsign='".$res[callsign]."' where pilotidid='".$res[pilotid]."'\r\n";
    }

	$r = mysql_query("select id, callsign, email from pilots where callsign LIKE '% %' or email LIKE '% %'");
    while ($res = mysql_fetch_assoc($r)) {

    	$res[callsign] = ereg_replace(" ","",$res[callsign]);
    	$res[email] = ereg_replace(" ","",$res[email]);

        mysql_query("update pilots set callsign='".$res[callsign]."', email='".$res[email]."' where id='".$res[id]."'");
               echo "update pilots set callsign='".$res[callsign]."', email='".$res[email]."' where id='".$res[id]."'\r\n";
    }



?>